package com.ge.demo.restfulws.controller;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ge.demo.restfulws.beans.Company;
import com.ge.demo.restfulws.beans.Deal;

@Controller
@RequestMapping("/")
public class DealController {

	@RequestMapping("company/{companyId}")
	public @ResponseBody
	Company getParticipantByCompanyId(@PathVariable("companyId") long companyId) {
		Company company = new Company();
		company.setCompanyId(1L);
		company.setCompanyName("Company Name");
		return company;
	}

	@RequestMapping("deal/{preCloseId}")
	public @ResponseBody
	Deal getDealByPreCloseId(@PathVariable("preCloseId") long preCloseId) {
		List<Company> participants = new ArrayList<Company>();
		participants.add(getParticipantByCompanyId(1L));

		Deal deal = new Deal();
		deal.setDealName("Some Deal NAme");
		deal.setParticipants(participants);
		deal.setPostCloseId("000145278");
		deal.setPreCloseId("1");

		return deal;
	}

}
